Portfolio

ESS 523A Geospatial Projects

Creating an interactive map

One of the projects we were tasked with was to create an interactive map based on data that was given to us, in this case the elevation of each county in a state of our choice.

Mosaicing & Projecting
Note: Elevation units are in meters.

Data wrangling to create a personalized map

Building off of that assignment, we were then tasked with finding two datasets on our own and mapping them together in a way that answers and interesting question. After looking through ScienceBase, IRMA, and Data.gov, I decided on combining oil well and airport geodata to answer the question, “How far are oil fields from the nearest airport in each Utah county?”

To answer this question, I first had to prepare my data and clean up the metadata:

#Utah extent
ut_counties <- counties(state = "UT")
Retrieving data for the year 2024
#Oil well production shapefile
wellStatus_sf <- read_sf("data/cells.shp")
wellFields <- st_union(wellStatus_sf) %>%
  st_make_valid()
wellFields_prj <- st_transform(wellFields, st_crs(ut_counties))
wellFields_crop <- st_intersection(wellFields_prj, ut_counties)
wellFields_centroid <- st_centroid(wellFields_crop)
wellFields_point <- st_sf(geometry = wellFields_centroid)


#Aviation facilities shapefile
aviation_sf <- read_sf("data/Aviation_Facilities.shp") %>%
  filter(STATE_CODE == "UT")
aviation_prj <- st_transform(aviation_sf, st_crs(ut_counties))

#CRS projection check
st_crs(wellFields_point) == st_crs(aviation_prj) #True
[1] TRUE
#Distance calculation
wellFields_point$nearest_airport <- st_nearest_feature(wellFields_point, aviation_prj)
wellFields_point$airport_dist_m <-
  st_distance(wellFields_point, aviation_prj[wellFields_point$nearest_airport, ], by_element = TRUE) %>%
  as.numeric(wellFields_point$airport_dist_m)

#Join ut_counties to aviation_prj
aviation_prj$COUNTY_NAM <- tolower(aviation_prj$COUNTY_NAM)
ut_counties$NAME <- tolower(ut_counties$NAME)
ut_counties <- rename(ut_counties, COUNTY_NAM = "NAME")

county_aviation <- st_join(ut_counties, aviation_prj, join = st_intersects,, left = TRUE) %>%
  group_by(COUNTY_NAM.x) %>%
  summarize(airports = n())

One of the most difficult parts of this process was that I thought the oil well data was a points feature, and it took me many failed attempts to realize it was actually full of small polygons. To remedy this, I combined each congruent polygon into one large geometry, and then used the centroid of this “oil well field” to create a much smaller, more manageable point feature.

Then, I mapped distance to airport vs number of airports in each county:

[cols4all] color palettes: use palettes from the R package cols4all. Run
`cols4all::c4a_gui()` to explore them. The old palette name "brewer.BuPu" is
named "bu_pu" (in long format "brewer.bu_pu")